home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / pack / xpk_Source.lha / xpk_Source / test / chunkhook.c next >
C/C++ Source or Header  |  1998-11-09  |  923b  |  36 lines

  1. #include <xpk/xpk.h>
  2.  
  3. #ifdef __MAXON__
  4.   #define __asm
  5.   #define __saveds
  6. #endif
  7.  
  8. ULONG __asm __saveds chunkfunc(register __a1 struct XpkProgress *prog)
  9. {
  10.   ULONG i;
  11.  
  12.   switch(prog->xp_Type)
  13.   {
  14.   case XPKPROG_START: PutStr("Start: "); break;
  15.   case XPKPROG_MID: PutStr("\rMid  : "); break;
  16.   case XPKPROG_END: PutStr("\rEnd  : "); break;
  17.   }
  18.  
  19.   if(prog->xp_Type != XPKPROG_END)
  20.     Printf("%4s: %-8s (%3ld%% done, %2ld%% CF, %6ld cps) %s",
  21.       prog->xp_PackerName, prog->xp_Activity, prog->xp_Done,
  22.       prog->xp_CF, prog->xp_Speed, prog->xp_FileName);
  23.   else
  24.     Printf("%4s: %-8s (%3ldK, %2ld%% CF, %6ld cps) %s\033[K\n",
  25.       prog->xp_PackerName, prog->xp_Activity, prog->xp_ULen >> 10,
  26.       prog->xp_CF, prog->xp_Speed, prog->xp_FileName);
  27.  
  28.   Flush(Output());
  29.   if((i = SetSignal(0, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C))
  30.     Printf("\n");
  31.   return i;
  32. }
  33.  
  34. struct Hook chunkhook = { {0}, (ULONG (*)()) chunkfunc};
  35.  
  36.